#!/bin/bash  
  
# 开启调试模式，打印执行的每条命令  
set -x  

if [ -d "$(pwd)/build" ]; then  
    rm -rf "$(pwd)/build/*"  
else  
    echo "Build directory does not exist. Creating it..."  
    mkdir -p "$(pwd)/build"  
fi  
  
# 进入 build 目录  
cd "$(pwd)/build" || exit  
  
# 配置 CMake  
cmake .. || exit  
  
# 编译项目  
make || exit
